var name="";
$(function(){
	$("#name").blur(function(){
		name=this.value;
		name=$.trim(name);
		if(name == ""){
			layer.open({
			    content:'请填写您的姓名!',
			    time: 2
			});
		}else if(name.length > 8){
			layer.open({
			    content:'您填写的昵称格式不正确!',
			    time: 2
			});
		}
	});
});
function save(){
	if($.trim(name) == ""){
		window.location.href="toSetup";
		return false;
	}else if(name.length > 8){
		return false;
	}else{
	$.ajax({
		url:"saveName",
		type:"post",
		data:{"name":name},
		success:function(data){
			layer.open({
			    content:data.result.message,
			    style: 'background-color:rgba(0,0,0,.8); color:#fff; border:none;',
			    time: 1,
			    shade: false 
			});	
			$("#name").val("");
			window.location.href="toSetup";
		}
	});
	}
}




